package com.example.spring4.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class UserAspect {
    @Pointcut("execution(public * com.example.spring4.service..*.add(..))")
    public void myFuncation(){

    }
    @Before("myFuncation()")
    public void beforeFun(){
        System.out.println("这是前置通知");
    }
    @After("myFuncation()")
    public void afterFun(){
        System.out.println("这是后置通知");
    }
    @Around("myFuncation()")
    public void aroundMethod(ProceedingJoinPoint pjp)throws Throwable{
        System.out.println("around start");
        pjp.proceed();
        System.out.println("around end");
    }
}
